﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using proRFID_DiemDanh.Chung;
using System.Data;
using System.Data.SqlClient;


namespace proRFID_DiemDanh.GiaoVien
{
    public class mdGiaoVien
    {
        public static DataTable sp_GiaoVien_Insert(string HoGV, string TenGV, int MaKhoa)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_GiaoVien_Insert", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@HoGV", HoGV);
            da.SelectCommand.Parameters.AddWithValue("@TenGV", TenGV);
            da.SelectCommand.Parameters.AddWithValue("@MaKhoa", MaKhoa);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_GiaoVien_Select(int MaGV, int MaKhoa)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_GiaoVien_Select", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaGV", MaGV);
            da.SelectCommand.Parameters.AddWithValue("@MaKhoa", MaKhoa);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_GiaoVien_Update(int MaGV, string HoGV, string TenGV, int MaKhoa)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_GiaoVien_Update", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaGV", MaGV);
            da.SelectCommand.Parameters.AddWithValue("@HoGV", HoGV);
            da.SelectCommand.Parameters.AddWithValue("@TenGV", TenGV);
            da.SelectCommand.Parameters.AddWithValue("@MaKhoa", MaKhoa);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_GiaoVien_Delete(int MaGV)
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_GiaoVien_Delete", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MaGV", MaGV);
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
        public static DataTable sp_Khoa_DDL()
        {
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = new SqlCommand("sp_Khoa_DDL", mdMain.cnn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            DataTable dt = new DataTable();
            da.Fill(dt);
            return dt;
        }
    }
}